// 0 引入 用来发送请求的 方法 一定要把路径补全
import {request} from '../../request/index.js';

Page({
    data: {
        swiperList: [],  //轮播图数据
        catesList: [],   //分类数据
        floorList: []    //楼层数据
    },

    //页面开始加载就会触发
    onLoad: function (options) {
        this.getSwiperList();
        this.getCateList();
        this.getFloorList();
    },

    // 获取轮播图数据
    getSwiperList() {
        request({url: '/home/swiperdata'})
            .then((res) => {
                const swiperList = res || [];
                this.setData({swiperList});
            });
    },

    // 获取分类导航数据
    getCateList() {
        request({url: '/home/catitems'})
            .then((res) => {
                const catesList = res || [];
                this.setData({catesList});
            });
    },

    // 获取 楼层数据
    getFloorList() {
        request({url: "/home/floordata"})
            .then(res => {
                const floorList = res || [];
                this.setData({floorList});
            })
    },
})
